home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 871 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  904 b 

  1. Path: news.netvision.net.il!usenet
  2. From: simchoni@netvision.net.il (Ami Simchoni)
  3. Newsgroups: comp.lang.c
  4. Subject: Q.: How does strtol() handles overflows?
  5. Date: 9 Jan 1996 18:27:29 GMT
  6. Organization: Simchoni Automation Systems Ltd
  7. Message-ID: <4cuc2h$gup@news.netvision.net.il>
  8. NNTP-Posting-Host: ts4cp13.netvision.net.il
  9. Mime-Version: 1.0
  10. X-Newsreader: WinVN 0.99.3
  11.  
  12. Hi,
  13.  
  14. I am trying to make a rubust ascii-to-decimal function which handles 
  15. input errors and overflows. I want to rely on the standard library as 
  16. much as possible.
  17.  
  18. Borland C++ 3.1 and 4.02 doumentation says if an overflow occurs strtol 
  19. just returns zero - which is not satisfactory, of course.
  20.  
  21. The BC++3.1 library source which I have, however, sets errno to ERANGE 
  22. and returns LONG_MIN or LONG_MAX on overflow. This appears both in the 
  23. code and in the comments.
  24.  
  25. Does anybody know what the standard says about it?
  26.  
  27. Thanks,
  28. Uri. 
  29.  
  30.